<template>
    <div>
        <ul class="mui-table-view">
            <li class="mui-table-view-cell mui-media" v-for="item in list" :key="item.store_id">
                <router-link :to="'/home/newsinfo/'+item.id">
                    <img class="mui-media-object mui-pull-left" :src="item.img_url">
                    <div class="mui-media-body">
                        <h1>{{item.title}}</h1>
                        <p class='mui-ellipsis'>
                            <span>发表时间： {{item.start_time | dataFormat}}</span>
                            <span>点击：{{item.store_id}}次</span>
                        </p>
                    </div>
                </router-link>
            </li>

        </ul>


    </div>
</template>
<style lang="scss" scoped>
.mui-table-view{
    li {
        h1{
            font-size:14px;
        }
        .mui-ellipsis{
            font-size: 12px;
            color: #226aff;
            display: flex;
            flex-direction: row;
            justify-content: space-between;
        }
    }
    
}
.mui-table-view-cell:after{
    right: 15px
}
</style>
<script>
import { Toast } from "mint-ui";
export default {
    data(){
        return {list:[]}
    },
    methods:{
        getNewsList(){
            // 获取新闻列表
            var imgArr=[
                'https://ps.ssl.qhimg.com/t01f7dc3221016a7ba3.jpg',
                'https://ps.ssl.qhimg.com/t016298ce47f73e9de3.jpg',
                'https://ps.ssl.qhimg.com/t01c3554230fb17b8a9.jpg',
                'https://ps.ssl.qhimg.com/t011673529abc109991.jpg',
                'https://ps.ssl.qhimg.com/t01dcdea3bd49e820e6.jpg',
                'https://ps.ssl.qhimg.com/t0169dd4ddc9306e9a2.jpg',
                'https://ps.ssl.qhimg.com/t0152c087ad22250896.jpg',
                'https://ps.ssl.qhimg.com/t01c367b0c23fa068e5.jpg',
                'https://ps.ssl.qhimg.com/t01f7dc3221016a7ba3.jpg',
                'https://ps.ssl.qhimg.com/t016298ce47f73e9de3.jpg',
                'https://ps.ssl.qhimg.com/t01c3554230fb17b8a9.jpg',
                'https://ps.ssl.qhimg.com/t011673529abc109991.jpg',
                'https://ps.ssl.qhimg.com/t01dcdea3bd49e820e6.jpg',
                'https://ps.ssl.qhimg.com/t0169dd4ddc9306e9a2.jpg',
                'https://ps.ssl.qhimg.com/t0152c087ad22250896.jpg',
                'https://ps.ssl.qhimg.com/t01c367b0c23fa068e5.jpg',
                'https://ps.ssl.qhimg.com/t01f7dc3221016a7ba3.jpg',
                'https://ps.ssl.qhimg.com/t016298ce47f73e9de3.jpg',
                'https://ps.ssl.qhimg.com/t01c3554230fb17b8a9.jpg',
                'https://ps.ssl.qhimg.com/t011673529abc109991.jpg',
                'https://ps.ssl.qhimg.com/t01dcdea3bd49e820e6.jpg',
                'https://ps.ssl.qhimg.com/t0169dd4ddc9306e9a2.jpg',
                'https://ps.ssl.qhimg.com/t0152c087ad22250896.jpg',
                'https://ps.ssl.qhimg.com/t01c367b0c23fa068e5.jpg',
                'https://ps.ssl.qhimg.com/t01f7dc3221016a7ba3.jpg',
                'https://ps.ssl.qhimg.com/t016298ce47f73e9de3.jpg',
                'https://ps.ssl.qhimg.com/t01c3554230fb17b8a9.jpg',
                'https://ps.ssl.qhimg.com/t011673529abc109991.jpg',
                'https://ps.ssl.qhimg.com/t01f7dc3221016a7ba3.jpg'
            ]
            var arrId = ['1696','1693','1675','1684','3042','1694','1512','3011','1709','1696','1693','1675','1684','3042','1694','1512','3011','1709']
            var that = this;
            that.$http.get('https://api.meiktv.com/pc/store/list').then(res=>{
                console.log(res)
                if(res.status == 200){
                    var list = res.body.data.slice(0,18);
                    var n = -1;
                    for(var i=0;i<list.length;i++){
                        // if(i<18){
                            n++
                            n>9?n=n:n='0'+n
                            list[i].start_time = '20'+n+'-'+'01-01T06:06:'+n+'.0000Z'
                            list[i].img_url = imgArr[i]
                            list[i].id = arrId[i]
                        // }
                        
                    }
                    that.list = list
                }else{
                    Toast('获取新闻列表失败')
                }
            })
        }
    },
    created(){
        this.getNewsList()
    }
}
</script>